package com.mycompany.myproject;

import com.mycompany.myproject.bean.Car;
import com.mycompany.myproject.config.MyComponent;
import com.mycompany.myproject.service.CarService;
import org.springframework.context.annotation.*;

import java.util.Arrays;

@Configuration
@ComponentScan()
@EnableAspectJAutoProxy(proxyTargetClass=true)
@PropertySource("classpath:application.properties")
public class MyApplication {


	public static  void main(String[] args){

		System.out.println("test");
		AnnotationConfigApplicationContext context = null;

		context = new AnnotationConfigApplicationContext(MyApplication.class);

		//context = new AnnotationConfigApplicationContext("com.mycompany.myproject");

//		String[] bdns = context.getBeanDefinitionNames();
//		Arrays.asList(bdns).stream().forEach(System.out::println);

		CarService carService = context.getBean("carService", CarService.class);
		System.out.println(carService.getAppName());

		context.destroy();

	}

}
